import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class TagDemoPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return TagDemoPageState();
  }
}

class TagDemoPageState extends State<TagDemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('Tag例子')),
        body: Container(
          child: Wrap(
            children: <Widget>[
              TagItem("start"),
              for (var item in textList) TagItem(item),
              TagItem("end")
            ],
          ),
        ));
  }
}

class TagItem extends StatelessWidget {
  String text;

  TagItem(this.text);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(10),
      padding: EdgeInsets.all(10),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(5)),
        color: Colors.blueAccent.withAlpha(60),
      ),
      child: Text(text),
    );
  }
}

List<String> textList = [
  "bb111111",
  "23ffaaa11",
  "113sfg1",
  "411d1233",
  "ddddd",
  "adfasdf",
];
